package javawork;
import java.util.Scanner;

public class section2_2 {
    public static void main(String[] args) {
        // 创建Scanner对象用于读取输入
        Scanner input = new Scanner(System.in);
        
        // 提示用户输入半径和长度
        System.out.print("Enter the radius and length of a cylinder: ");
        
        // 读取用户输入的半径和长度
        double radius = input.nextDouble();
        double length = input.nextDouble();
        
        // 计算底面积 (πr²)
        double area = Math.PI * radius * radius;
        
        // 计算体积 (底面积 × 长度)
        double volume = area * length;
        
        // 输出结果，保留四位小数
        System.out.printf("The area is %.4f%n", area);
        System.out.printf("The volume is %.1f%n", volume);
        
        // 关闭Scanner
        input.close();
    }
}
    